﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ApprovalTests;
using ApprovalUtilities;
using ApprovalUtilities.Persistence;
using ApprovalTests.Reporters;


namespace DatabaseTest
{
    
        [TestClass]
        public class TestDatabase
        {

            #region SQLWeatherIsDatabaseAlive
        
            [UseReporter(typeof(ApprovalTests.Reporters.DiffReporter))]
            [TestMethod]
            public void TestDatabseQuery()
            {
                Approvals.Verify(new SQLWeatherLoader("Irvine"));
            }
            #endregion

            #region ShowAssemblyReporterConfig

            [TestMethod]
            public void TestInsultLoader()
            {
                    string conn =@"server=.\sqlexpress;database=Insults;trusted_connection=true";
                    Approvals.Verify(new InsultLoaderShortAndSweet(7,5,conn));
            }
        
   
            //[assembly: UseReporter(typeof(DiffReporter))]
            #endregion

            #region QueryAdventureWorksLT

             [UseReporter(typeof(ApprovalTests.Reporters.DiffReporter))]
            [TestMethod]
            public void TestAdventureWorksLTLoader()
            {
                    string conn =@"server=.\expressr2;database=AdventureWorksLT;trusted_connection=true";
                    Approvals.Verify(new AdventureWorksLTLoader(100, conn));
            }

             [UseReporter(typeof(ApprovalTests.Reporters.DiffReporter))]
             [TestMethod]
             public void TestReport()
             {
                 var c = new []{new Customers{FirstName= "Lynn", LastName="Langit"},
                     new Customers{FirstName= "Llewellyn", LastName="Falco"}};
                 var b = ReportGenerator.ShowCustomers(new MockLoader<Customers[]>(c));
                 Approvals.VerifyBinaryFile(b ,"tiff");
             }
        }
             #endregion


}

